package com.kapcb.ruleengine.test;

import com.kapcb.ruleengine.api.Rule;
import com.kapcb.ruleengine.api.RuleEngine;
import com.kapcb.ruleengine.core.DefaultRuleEngine;
import com.kapcb.ruleengine.core.RuleBuilder;

/**
 * <a>Title: HelloWorld </a>
 * <a>Author: Kapcb <a>
 * <a>Description: HelloWorld <a>
 *
 * @author Kapcb
 * @version 1.0
 * @date 2024/8/24 20:18
 * @since 1.0
 */
public class HelloWorld {

    public static void main(String[] args) {
        RuleEngine ruleEngine = new DefaultRuleEngine();
        Rule rule = new RuleBuilder()
                .name("hello world rule")
                .description("always say hello world")
                .priority(1)
                .when(facts -> true)
                .then(facts -> System.out.println("hello world"))
                .build();

        ruleEngine.fire(rule, null);
    }

}
